const express = require('express');
const db = require('./database/db');
const cors = require('cors');
const authRouter = require('./router/authRouter');
//<<<<<<< HEAD
const adminRouter = require('./router/adminRouter');
const userRouter = require('./router/userRouter');
const bvoRouter = require('./router/bvoRouter');
const orderRouter = require('./router/orderRouter');
const productRouter=require('./router/productRouter');
//=======
//>>>>>>> c680efe446243c5592efdc87d6fac954b954642f

// 创建app对象
const app = express();
 //跨域
app.use(cors());
// 应用一些中间件
app.use(express.json()); // 解析客户端传递过来的json
// 解析传递过来urlencoded的时候, 默认使用的node内置querystring模块
// { extended: true }: 不再使用内置的querystring, 而是使用qs第三方库
app.use(express.urlencoded({ extended: true })); // 解析客户端传递过来的urlencoded
 
//设置路由
app.use(authRouter);
//<<<<<<< HEAD
app.use(adminRouter);
app.use(userRouter);
app.use(bvoRouter);
app.use(orderRouter);
app.use(productRouter);

//=======
//app.use(xxxRouter);
//app.use(xxxRouter);
//>>>>>>> c680efe446243c5592efdc87d6fac954b954642f


// 启动服务器
app.listen(9000, () => {
  console.log('express服务器启动成功，监听端口号：9000');
})